<?php session_start();?>

<?php if(isset($_SESSION['user'])){ ?> 
<html>
<head>
<title>Employee Income</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
	font-family: Cambria;
	color: #000080;
}
.style2 {color: #000099}
.style4 {font-size: 18px}
.style8 {font-size: 18px; font-weight: bold; }
.style9 {
	color: #000080;
	font-weight: bold;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<!-- ImageReady Slices (Untitled-1) -->
<table width="620" height="650" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
	<tr>
		<td><table width="620" height="204" border="0" background="images/report_01.png">
          <tr height="10%">
            <td><div align="center">
              <h1 class="style1">NAWODAYA INSTITUTE (PVT) LTD </h1>
            </div></td>
          </tr>
          <tr height="10%">
            <td bgcolor="#FFFFFF"> <div align="center" class="style2">No: 66/12, <br>
Yatiyanthota road,<br>
Awissawella.</div></td>
          </tr>
          <tr>
            <td><div align="center" class="style2">Tel : 036-2230454/Fax : 94-3-2687014<br>
Email : avinavodaya@gmail.com</div></td>
          </tr>
		  
		  <tr>
		    <td>&nbsp;</td>
		  </tr>
          <tr>
            <td height="3" background="images/report_04.png" style="background-repeat:no-repeat">&nbsp;</td>
          </tr>
        </table></td>
	</tr>
	<tr>
		<td>
		 <?php 
			include'../logic/Classes/db.php';                             
			include'../logic/Classes/reportHandler.php';     
			
			$empno=$_GET['empno'];
			$year=$_GET['year'];
			$month=$_GET['month'];
			
			$y=new DbConnect();
            $con=$y->getConnection();
			
			$rep=new ReportHandler();
			$rep->setCon($con);
			
			$result=$rep->getEmpIncomeReport($empno,$year,$month);
			$time_now=mktime(date('H')+5,date('i')+30,date('s'),date('m'),date('d')+1,date('Y'));
			$num=mysql_num_rows($result);
			$tot=0;
			
			
            if($month==1){

            $mon="January";

            } elseif($month==2){

            $mon="February";

            } elseif($month==3){

            $mon="March";

            } elseif($month==4){

            $mon="April";

            } elseif($month==5){

            $mon="May";

            } elseif($month==6){

            $mon="June";

            }elseif($month==7){

            $mon="July";

           }elseif($month==8){

           $mon="August";

           }elseif($month==9){

           $mon="September";

           }elseif($month==10){

           $mon="October";

          }elseif($month==11){

          $mon="November";

         } else{

        $mon="December";
        }

			?>
			
		<table width="620" height="534" border="0" background="images/report_02.png">
          <tr>
            <td height="100"><h3 align="center">Monthly Course Fee Collection </h3>
              <br/>
			<?php 
			
			if(!($num==0)) {?>
              
			  <table width="100%" border="0">
                <tr>
                  <td width="31%"><div align="right"><strong>Year </strong></div></td>
                  <td width="3%">&nbsp;</td>
                  <td width="1%"><div align="center"><strong>:</strong></div></td>
                  <td width="22%"><div align="left"><?php echo $year; ?></div></td>
                  <td width="11%"><div align="left"><strong>Month</strong></div></td>
                  <td width="1%"><div align="center"><strong>:</strong></div></td>
                  <td width="31%"><div align="left"><?php echo $mon; ?></div></td>
                </tr>
                <tr>
                  <td colspan="7">&nbsp;</td>
                </tr>
              </table>
              <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
			  			
                <tr>
                  <th height="21"  bgcolor="#FFFFFF" class="style1"><div align="center" class="style4"><span class="style1">Subject</span></div></th>
                  <th width="32%" bgcolor="#FFFFFF" class="style1"><div align="center" class="style8">Grade</div></th>
                  <th width="33%" bgcolor="#FFFFFF" class="style1"><div align="center" class="style8">Income</div></th>
                </tr>
				    <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
				<?php while($row=mysql_fetch_array($result)) { 
				
				$tot=$tot+$row['income'];
				?>
                  
              
                  <tr>
                  <td><div align="center"><?php echo $row['subject'];?> </div></td>
                  <td><div align="center"><?php echo $row['grade'];?>
                    </div></td>
                  <td><div align="center"><?php echo "Rs.".$row['income'].".00"; ?></div></td>
                </tr>
				<?php } ?>
				<tr>
				  <td colspan="3"><hr></td>
			    </tr>
				<tr>
                    <td colspan="2"><div align="right" class="style9">Whole Collection </div></td>
                    <td><div align="center"><strong><?php echo "Rs.".$tot.".00"; ?></strong></div></td>
                </tr>
              </table>
			  <?php } else{ ?> <div align="center"> <strong> There is no record to display </strong></div><?php } ?>
			 
            </td>
          </tr>
          <tr height="20"><td height="20">&nbsp;</td></tr>
          
         
        </table></td>
	</tr>
	<tr>
		<td><table width="620" height="42" border="0" >
          <tr>
            <td><table width="620" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="44" >&nbsp;</td>
                <td width="111" height="20" background="images/Untitled-1.jpg">&nbsp;&nbsp;&nbsp;<?php echo $_SESSION['user']; ?></td>
                <td width="338" >&nbsp;</td>
                <td width="96" background="images/Untitled-1.jpg">&nbsp;&nbsp;&nbsp;<?php echo date('Y-m-d',$time_now);  ?></td>
                <td width="31" >&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td height="27"><strong>&nbsp;&nbsp;Issued By <strong></td>
                <td>&nbsp;</td>
                <td>&nbsp;&nbsp;<strong>Issued Date</strong></td>
                <td>&nbsp;</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
	</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>
<?php  } else { header("location:../../index.php");   }?>